# encoding:utf-8
import requests
from flask import jsonify
import base64
# client_id 为官网获取的AK， client_secret 为官网获取的SK
CLIENT_ID = "QoBrXR6QSMy0WgrXCrgdS50S"
CLIENT_SECRET = "QaQXVKhgy3GGsy9dHUOj4GX1pKEYrURU"
TEST_SWITCH = 0

def get_token():
     token_url = 'https://aip.baidubce.com/oauth/2.0/token'
     params = ['grant_type=client_credentials', f'client_id={CLIENT_ID}', f'client_secret={CLIENT_SECRET}']
     params = '&'.join(params)
     req_url = f'{token_url}?{params}'
     response = requests.get(req_url)
     if response:
         print(response.json())
         return response.json()["access_token"]

